std::sub_match

From Cppreference

Jump to: navigation, search
Defined in header <regex>

template<

    class BidirectionalIterator

> class sub_match;
(C++11 feature)

The class template sub_match is used by the regular expression engine to denote sequences of characters matched by marked sub-expressions.

Inherits std::pair<BidirectionalIterator, BidirectionalIterator>

Several specializations for common character sequence types are provided:

Defined in header <regex>
Type Definition
csub_match sub_match<const char*>
wcsub_match sub_match<const wchar_t*>
ssub_match sub_match<std::string::const_iterator>
wssub_match sub_match<std::wstring::const_iterator>

Contents

[edit] Member types

Member type Definition
iterator BidirectionalIterator
value_type std::iterator_traits<BidirectionalIterator>::value_type
difference_type std::iterator_traits<BidirectionalIterator>::difference_type
string_type std::basic_string<value_type>

[edit] Member functions

(constructor)
constructs the match object
(public member function)
Observers
length
returns the length of the match, if any
(public member function)
operator string_type
cast to the underlying string type
(public member function)
str
returns the matched subsequence
(public member function)
compare
compares matched subsequence (if any)
(public member function)

Member objects

matched
defines whether this match was successful
(public member object)

[edit] Non-member functions